From 9514bdfa7ad1f6595d50bf144a58a6a786953b3f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 30 Jun 2025 16:34:11 -0400 Subject: [PATCH] deploy: Default quiet for forked systemctl I'm checking over the codebase for places we fork children; doing so from a library means we may end up printing to stdout/stderr of our caller, which we shouldn't do. - Also add an error prefix with information about the service if we fail Signed-off-by: Colin Walters --- src/libostree/ostree-sysroot-deploy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 2d676be1..be6f4c0d 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -3779,6 +3779,8 @@ ostree_sysroot_stage_tree_with_options (OstreeSysroot *self, const char *osname, GCancellable *cancellable, GError **error) { GLNX_AUTO_PREFIX_ERROR ("Staging deployment", error); + // The service which performs finalization + const char *svc = "ostree-finalize-staged.service"; if (!_ostree_sysroot_ensure_writable (self, error)) return FALSE; @@ -3787,14 +3789,14 @@ ostree_sysroot_stage_tree_with_options (OstreeSysroot *self, const char *osname, if (booted_deployment == NULL) return glnx_prefix_error (error, "Cannot stage deployment"); - const char *const systemctl_argv[] - = { "systemctl", "start", "ostree-finalize-staged.service", NULL }; + const char *const systemctl_argv[] = { "systemctl", "start", "--quiet", svc, NULL }; int estatus; - if (!g_spawn_sync (NULL, (char **)systemctl_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, - NULL, &estatus, error)) + if (!g_spawn_sync (NULL, (char **)systemctl_argv, NULL, + G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, + &estatus, error)) return FALSE; if (!g_spawn_check_exit_status (estatus, error)) - return FALSE; + return glnx_prefix_error (error, "Failed to start %s", svc); g_autoptr (OstreeDeployment) deployment = NULL; if (!sysroot_initialize_deployment (self, osname, revision, origin, opts, &deployment, -- 2.30.2